package renderers 
{
	import flash.display.DisplayObject;
	import flash.display.DisplayObjectContainer;
	import flash.display.Stage;
	import flash.utils.Dictionary;
	/**
	 * ...
	 * @author Gareth Williams
	 */
	public class Renderer
	{
		protected static var stage:Stage = null;
		protected var renderables:Dictionary = new Dictionary(true); //may have been better off with a vector ?
		public function Renderer(stage:Stage) 
		{
			Renderer.stage = stage;
		}
		public static function get rootDisplayObject():DisplayObjectContainer
		{
			return stage;
		}
		public function destructor():void
		{
			for each (var key:Object in renderables) key = null;
		}
		public function render():void
		{
			throw new UnimplementedAbstract("Renderer::render");
		}
		public function addRenderable(renderable:IRenderable):void
		{
			//todo:subclasses could add z-index sorting etc... here 
			renderables[renderable] = true;
		}
		public function removeRenderable(renderable:IRenderable):void
		{
			renderables[renderable] = false;
		}
	}
}